#include "myelf.h"
#include "new_sprintf.h"
/*
    演示通过nes_sprintf组包之后的数据流通过rodata段重新解析
*/
int main(int argc, char **argv)
{

    char test1[] = "test string 1";
    int a = 100;
    char test2[] = "test string 2";
    char buf_in[100] = {0};
    char buf_out[100] = {0};
    if (argc != 2)
    {
        printf("Usage: ./test3 test3\n");
        return 0;
    }
    int len = new_sprintf(buf_in, "%s %d %s", test1, a, test2)
        rodata_info_t *info_p = load_elf_file(argv[1]);
    if (NULL != info_p)
    {
        if (64 == info_p->class_type)
        {
            buf2str_bitStream(info_p, buf_out, 100, buf_in, len);
            printf("get string :%s\n", buf_out);
        }
    }
    else
    {
        printf("error when load_elf_file\n");
    }
    free_elf_resource(info_p);
    return 0;
}